import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:search_people/utils/img_util.dart';

import '../index.dart';

/// hello
class TouchOprationWidget extends GetView<TrdTouchController> {
  const TouchOprationWidget({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    var state = controller.state;
    return ClipRRect(
      borderRadius: BorderRadius.circular(8.r),
      child: Container(
        width: 180.r,
        color: Colors.white30,
        child: Column(
          children:
              state.oprations.map((e) => TouchOprationCell(md: e)).toList(),
        ),
      ),
    );
  }
}

class TouchOprationCell extends StatelessWidget {
  const TouchOprationCell({
    Key? key,
    required this.md,
  }) : super(key: key);
  final TrdOprationModel md;
  @override
  Widget build(BuildContext context) {
    return Container(
      height: 40.r,
      margin: const EdgeInsets.only(bottom: 1),
      color: Colors.white70,
      padding: EdgeInsets.symmetric(horizontal: 10.r),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          Text(
            md.name,
            style: TextStyle(color: const Color(0xff333333), fontSize: 14.sp),
          ),
          loadImage(url: md.url, width: 20.r, height: 20.r),
        ],
      ),
    );
  }
}
